package com.bl.controller;

import com.bl.pojo.req.SmsLoginReq;
import com.bl.pojo.resp.BaseResult;
import com.bl.service.IUserService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 范浩田
 * @Date: 2021/9/3 16:05
 */
@RestController
@RequestMapping("/user")
public class UserController {
     @Autowired
     IUserService iuserService;

     /**
      * 发送手机验证码
      * @param phoneNumber
      * @return
      */
     @GetMapping(value = "/sendMobileCode")
     public BaseResult sendMobileCode(@RequestParam("phoneNumber") String phoneNumber) {
          return iuserService.sendPhoneCode(phoneNumber);
     }

     /**
      * 验证码登录
      *
      * @param
      * @return
      */
     @RequestMapping(value = "/insertUser", method = RequestMethod.POST)
     public BaseResult smsLogin(@RequestBody SmsLoginReq smsLoginReq) {
          return iuserService.smsLogin(smsLoginReq);
     }
}
